/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 29489
 * Date: 2023-03-01
 * Time: 22:28
 */
import java.util.Scanner;
public class Main1 {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

//         String str = sc.nextLine();
//         String s[] = str.split(" ");
        double max = 0;
        double min = 100;
        double sum = 0;
        for(int i = 0; i < n; i++)
        {
            //double score = sc.nextDouble();
            String str = sc.next();
            double score = Double.parseDouble(str);
            if(score > max)
                max = score;
            if(score < min)
                min = score;
            sum += score;
        }
        sum = sum - max - min;
        System.out.printf("%.2f\n", sum/(n-2));

        sc.close();
    }
}
